<template>
  <view class="wrap">
    <!-- #ifdef APP-PLUS -->
    <uv-navbar :title="title" autoBack placeholder></uv-navbar>
    <!-- #endif -->
    <uv-parse :content="detail"></uv-parse>
    <uv-safe-bottom></uv-safe-bottom>
  </view>
</template>

<script setup>
import { ref } from 'vue';
import { post } from '@/api';
import { onLoad } from '@dcloudio/uni-app';

let detail = ref('');
let title = ref('');

onLoad((option) => {
  if(option.id){
    getData(option.id)
  }
})

function getData(id){
  post('api/single_page/singlePageInfo', { id }).then(res => {
    if(res.code == 1){
      const data = res.data;
      detail.value = data.content;
      // #ifdef APP-PLUS
      title.value = data.name;
      // #endif
      // #ifdef WEB
      document.title = data.name;
      // #endif
    }
  })
}
</script>

<style lang="scss" scoped>
  .wrap{
    padding: 30rpx;
  }
</style>